package eval.host.compare;

import java.util.Collections;
import java.util.List;

import com.google.inject.Singleton;

import eval.host.Host;
@Singleton
public class AgeHostSortList implements ISortHostList{

	@Override
	public int compare(Host host1, Host host2) {
		if(host1.getTickHostTurnOn()==-1)
			if(host2.getTickHostTurnOn()>-1)
				return host2.getTickHostTurnOn();
			else 
				return -1;
		else if(host2.getTickHostTurnOn()==-1)
			return host1.getTickHostTurnOn();
		return host1.getTickHostTurnOn()- host2.getTickHostTurnOn();
			
	}

	@Override
	public List<Host> sortHostList(List<Host> hostToSort) {
		Collections.sort(hostToSort,this);
		return hostToSort;
	}

}
